package com.hrc.rpc.netty;

import com.hrc.rpc.netty.handler.service.RpcRequestHandler;
import com.hrc.rpc.netty.handler.service.ServiceAfterFilterHandler;
import com.hrc.rpc.netty.handler.service.ServiceBeforeFilterHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

public class ServerChannelInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) {
        ch.pipeline()
                .addLast(new StringEncoder())
                .addLast(new StringDecoder())
                .addLast(new RpcRequestHandler())
                .addLast(new ServiceBeforeFilterHandler())
                .addLast(new ServiceAfterFilterHandler());
    }
}


